package cn.chi.pay.service.impl;


import cn.chi.base.constant.PayTypeConstants;
import cn.chi.pay.domain.AlipayInfo;
import cn.chi.pay.domain.PayBill;
import cn.chi.pay.service.IPayService;
import cn.chi.util.AliPayUtils;
import org.springframework.stereotype.Service;

@Service
public class PayServiceImpl implements IPayService {

    @Override
    public String pay(PayBill payBill, AlipayInfo alipayInfo) {
        String result=null;
        //根据不同的支付方式，渠道的分发
        switch (payBill.getPayChannel()){
            case PayTypeConstants
                    .ALIPAY:
                //如果是支付宝支付
                result = AliPayUtils.payOrder(payBill,alipayInfo);
                break;
            case PayTypeConstants
                    .WECHATPAY:
                //微信支付的逻辑
                break;
            case PayTypeConstants
                    .UNIONPAY:
                //银联的逻辑
                break;

        }

        return  result;
    }
}
